<template>
	<view>
		{{ formater }}
	</view>
</template>

<script>
	export default{
		props:{
			timestamp: {
				type: Number,
				default: 0
			},
			format: {
				type: String,
				default: 'MM-dd hh:mm:ss'
			}
		},
		data(){
			return {
				formater:''
			}
		},
		watch:{
			timestamp(val) {
			    this.formatter = this.TIME_FORMAT(this.timestamp, this.format);
			 },
		},
		mounted(){
			this.formater = this.TIME_FORMAT(this.timestamp, this.format)
		},
		methods:{
			TIME_FORMAT(t, fmt){
				const newDate = new Date()
				newDate.setTime(t)
				return newDate.VP_FORMAT(fmt)
			}
		}
	}
</script>


<style>

</style>